<script>
$(document).ready( function(){
	$("#uForm_DealSubscription").submit(function(){
		$.post("/deal/subscription", $(this).serialize(), function(data){
			var errorsHolder = $("#uForm_DealSubscription_es_");
			if(data.errors && data.errors.length > 0){
				var errorItemsHolder = errorsHolder.find('ul'); 
				errorItemsHolder.html("");
				
				for(var i in data.errors){
					errorItemsHolder.append("<li>"+ data.errors[i].message+"</li>");
				}
				errorsHolder.show();
			}else{
				errorsHolder.hide();
				if(data.info){
					alert(data.info);
				}
			}
		}, 'json')
		return false;
	});
});
</script>

<form method="post" action="/deal/subscription" id="uForm_DealSubscription">
	<div style="visibility:hidden">
		<input type="hidden" id="yform_uForm_DealSubscription" name="yform_uForm_DealSubscription" value="1">
	</div>
	<div style="display:none" class="errorSummary" id="uForm_DealSubscription_es_"><p>Please fix the following input errors:</p>
		<ul><li>dummy</li></ul>
	</div>
	<div class="row field_email">
		<label class="required" for="MDealSubscribeForm_email" style="width:auto;"><span class="required">*</span>Your email address:</label>
		<input type="text" value="" id="MDealSubscribeForm_email" name="MDealSubscribeForm[email]">
	</div>

	<div class="row buttons" style="margin:0;"><input type="submit" value="Subscribe" name="submit">
	</div>
</form>
	
